﻿using System.Collections.Generic;

public class TKChessXie : BaseChess
{
    private Pos[] directions = new Pos[4] { new Pos(-1, -1), new Pos(-1, 1), new Pos(1, -1), new Pos(1, 1) };
    public TKChessXie(int camp, int team) : base(camp, team)
    {

    }
    public override void AddSomePosIntoList(BaseChessBoard chessBoard, List<Pos> tempPosList)
    {
        BaseGrid grid = chessBoard.GetGridByChess(this);
        if (grid != null)
        {
            Pos chessPos = grid.GetPos();
            Pos endPos;
            for (int i = 0; i < directions.Length; i++)
            {
                int j = 1;
                for (; ; j++)
                {
                    endPos = chessPos.AddResult(directions[i].MulResult(j));
                    if (chessBoard.SpaceIsGridAndNotExistChess(endPos))
                    {
                        tempPosList.Add(endPos);
                    }
                    else
                    {
                        break;
                    }
                }
                if (!chessBoard.SpaceIsGrid(endPos))
                {
                    continue;
                }
                else
                {
                    if (chessBoard.SpaceIsGridAndExistOtherTeamChess(endPos, GetTeam()))
                    {
                        tempPosList.Add(endPos);
                    }
                }
            }
        }
    }
    public override Score GetScore(BaseChessBoard baseChessBoard)
    {
        return new Score(18, 0);
    }
}